import React, { PureComponent } from 'react';
import { connect } from 'dva';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Card, Table } from 'antd';

@connect(({ empsearch, loading }) => ({
  loading: loading.models.empsearch,
  addTaskList: empsearch.addTaskList, // 增员任务列表数据
}))
@Form.create()
class EmpInfor extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {};
  }

  componentDidMount() {}

  jumpRouting = (targetRouter, addTaskId, taskSource) => {
    const { jumpRouting } = this.props;
    jumpRouting(targetRouter, addTaskId, taskSource);
  };

  render() {
    const { addTaskList, loading } = this.props;
    const columns = [
      {
        title: '客户名称',
        dataIndex: 'custName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
      },
      {
        title: '报价单',
        dataIndex: 'quoName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
      },
      {
        title: '服务类型',
        dataIndex: 'sendTypeName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
      },
      {
        title: '执行地',
        dataIndex: 'cityName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
      },
      {
        title: '状态',
        dataIndex: 'statusName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
      },
      {
        title: '来源',
        dataIndex: 'taskTypeName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
      },
      {
        title: '操作',
        dataIndex: 'operName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder', width: 150 } }),
        render: (text, record) => (
          <span
            style={{ color: '#1890FF', cursor: 'pointer' }}
            onClick={() => this.jumpRouting('addTaskId', record.addTaskId, record.taskSource)}
          >
            查看
          </span>
        ),
      },
    ];
    return (
      <div>
        <Card
          title={<span style={{ fontWeight: 'bolder' }}>增员任务</span>}
          // extra={<a onClick={() => this.jumpRouting('addTaskId')}>更多&gt;&gt;</a>}
        >
          <Table
            rowSelection={null}
            columns={columns}
            dataSource={addTaskList && addTaskList.list}
            loading={loading}
            rowKey="addTaskId"
            pagination={false}
          />
        </Card>
      </div>
    );
  }
}

export default EmpInfor;
